<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //请写一个函数，打印一个字符串中的第一个不重复的字符
      const str = 'dadashabi'
      function fn(str) {
        // 转成数组
        const arr = str.split('')
        let num
        for (i = 0; i < arr.length; i++) {
          num = 0
          for (j = 0; j < arr.length; j++) {
            if (arr[i] == arr[j]) {
              num += 1
            } else if (num > 1) {
              break
            }
          }
          if (num === 1) {
            console.log(arr[i])
            break
          }
        }
      }
      fn(str)
    </script>
  </body>
</html>
